package com.yhp.tag;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.BodyTagSupport;

import com.system.comm.util.SpringContextUtil;
import com.system.common.mapper.BisNurseTypeMapper;
import com.system.common.pojo.BisNurseType;

public class TypeIdTag extends BodyTagSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String typeId;
	public String getTypeId() {
		return typeId;
	}

	public void setTypeId(String typeId) {
		this.typeId = typeId;
	}
	@Override
	public int doStartTag() throws JspException { // 在标签开始处出发该方法
		JspWriter writer = this.pageContext.getOut();
		BisNurseTypeMapper btMapper=(BisNurseTypeMapper) SpringContextUtil.getBean("bisNurseTypeMapper");
		try {
			BisNurseType selectByPrimaryKey = btMapper.selectByPrimaryKey(typeId);
			if(selectByPrimaryKey!=null){
				writer.write(selectByPrimaryKey.getTypeName());
			}else{
				writer.write("数据有误");
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return BodyTagSupport.SKIP_BODY;
	}

	@Override
	public int doEndTag() throws JspException {
		return BodyTagSupport.EVAL_BODY_INCLUDE;
	}
	
}
